package com.vinyl.components 
{
	import fl.core.UIComponent;
	import flash.display.Sprite;
	import com.vinyl.components.IProgressView
	
	/**
	 * ...
	 * @author 
	 */
	public class SimpleProgress extends UIComponent
	{
		private var _ratio:Number
		private var _body:Sprite;
		private var _background:Sprite;
		
		public var rander:IProgressView
		
		[Inspectable(defaultValue=0)]
		public function get ratio():Number
		{ 
			return _ratio;
		}
		
		public function set ratio(value:Number):void
		{
			_ratio=value; 
			draw();	
		}
		
		public function SimpleProgress() 
		{
			super();
			_ratio = 0;
		}
		
		override protected function configUI():void
		{
			super.configUI();
			
			var bg = new ProgressBarBackground();
			var body = new ProgressBarBody();
			
			if ( bg && body )
			{
				_background=addChild(bg) as Sprite;
				_body=addChild(body) as Sprite;
			}
		}		
		
		override protected function draw():void
		{
			if ( rander )
			{
				rander.draw();
				super.draw();
				return;
			}
			
			_body.scaleX = _ratio;
			super.draw();
		}
	}
}